package com.redistest.seckill.controller;

import com.redistest.seckill.config.CurrentUser;
import com.redistest.seckill.pojo.User;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2025-04-06
 */
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/user")
public class UserController {

    @GetMapping("/info")
    public ResponseEntity<?> getUserInfo(@CurrentUser User user) {
        if (user == null) {
            return ResponseEntity.status(401).build();
        }

        // 返回用户信息
        return ResponseEntity.ok(user);
    }
}